package com.gf.exam.mapper;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.jdbc.core.RowMapper;

import com.gf.exam.model.AnswerCell;

/**
 * 
 * @author zhuguifeng guifeng.net@gmail.com
 * @version 创建时间：2013-1-18 下午3:17:19
 */
public class AnswerCellMapper implements RowMapper<AnswerCell> {

	private static final AnswerCellMapper MAPPER = new AnswerCellMapper();

	private static final String COLUME_ID = "id";
	private static final String COLUME_ANSWERID = "answerId";
	private static final String COLUME_CELLID = "cellId";
	private static final String COLUME_ANSWERRIGHT = "answerRight";
	private static final String COLUME_MOUSEACTION = "mouseAction";
	private static final String COLUME_INPUTACTION = "inputAction";
	private static final String COLUME_RT = "rt";

	public static AnswerCellMapper getMapper() {
		return MAPPER;
	}

	@Override
	public AnswerCell mapRow(ResultSet set, int row) throws SQLException {
		AnswerCell answerCell = new AnswerCell();

		answerCell.setId(set.getLong(COLUME_ID));
		answerCell.setAnswerId(set.getLong(COLUME_ANSWERID));
		answerCell.setCellId(set.getInt(COLUME_CELLID));
		answerCell.setAnswerRight(set.getInt(COLUME_ANSWERRIGHT));
		answerCell.setMouseAction(set.getString(COLUME_MOUSEACTION));
		answerCell.setInputAction(set.getString(COLUME_INPUTACTION));
		answerCell.setRt(set.getString(COLUME_RT));

		return answerCell;
	}

}
